package com.itheima.easy.mapper;

import com.github.pagehelper.Page;
import com.itheima.easy.entity.Resource;
import com.itheima.easy.vo.ResourceVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ResourceMapper {

    int deleteByPrimaryKey(Long id);

    int insert(Resource record);

    int insertSelective(Resource record);

    Resource selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Resource record);

    int updateByPrimaryKey(Resource record);

    int batchInsert(@Param("list") List<Resource> list);

    Page<List<Resource>> selectPage(@Param("resourceVo")ResourceVo resourceVo);

    List<Resource> selectList(@Param("resourceVo")ResourceVo resourceVo);

    List<ResourceVo> findResourceVoListInRoleId(@Param("roleIds") List<Long> roleIds, @Param("parentResourceNo")String parentResourceNo);

    List<ResourceVo> findButtonVoListInRoleId(@Param("roleIds") List<Long> roleIds, @Param("parentResourceNo")String parentResourceNo);

    List<ResourceVo> findResourceVoListByUserId(@Param("userId") Long userId);

    /**
     * 是否存在菜单子节点
     *
     * @param menuId 菜单ID
     * @return 结果
     */
    public int hasChildByMenuId(@Param("menuId") String menuId);

    /**
     * 删除菜单管理信息
     *
     * @param menuId 菜单ID
     * @return 结果
     */
    public int deleteMenuById(@Param("menuId") String menuId);
}
